var __extends =
    (this && this.__extends) ||
    (function () {
      var t = function (o, e) {
        return (t =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (t, o) {
              t.__proto__ = o;
            }) ||
          function (t, o) {
            for (var e in o)
              Object.prototype.hasOwnProperty.call(o, e) && (t[e] = o[e]);
          })(o, e);
      };
      return function (o, e) {
        function r() {
          this.constructor = o;
        }
        if ("function" != typeof e && null !== e)
          throw new TypeError(
            "Class extends value " + String(e) + " is not a constructor or null"
          );
        t(o, e),
          (o.prototype =
            null === e
              ? Object.create(e)
              : ((r.prototype = e.prototype), new r()));
      };
    })(),
  MatchHistoryDialog = (function (t) {
    function o() {
      var o = t.call(this) || this;
      return (
        o.btn_matchHis_cancle.on(
          Laya.Event.CLICK,
          o,
          o.onMatchHistoryCloseActin
        ),
        (o.list_match_history.vScrollBarSkin = ""),
        (o.list_match_history.selectEnable = !0),
        WebSocketService.addListener({
          caller: o,
          code: 1543,
          method: o.onLoadDouJiangTaiHistoryData,
        }),
        WebSocketService.addListener({
          caller: o,
          code: 1557,
          method: o.onLoadCurrentMonthHistoryData,
        }),
        o
      );
    }
    return (
      __extends(o, t),
      (o.openMatchHistoryDialog = function (t, e, r) {
        null == this.matchHistoryV && (this.matchHistoryV = new o()),
          this.matchHistoryV.popup(!0),
          e
            ? WebSocketService.send({
                c: 1543,
                d: { id: t.id, aid: r, pageNum: 0 },
              })
            : WebSocketService.send({ c: 1557, d: { id: t.id, pageNum: 0 } });
      }),
      (o.prototype.onLoadDouJiangTaiHistoryData = function (t) {
        if (0 == t.code) {
          this.histArray = t.list;
          var o;
          this.dataSource = [];
          for (var e = 0; e < this.histArray.length; e++) {
            var r = this.histArray[e];
            (o = {
              label_matchA_Index: { text: this.dealWinOrLose(r.r) },
              label_matchA_his_name: {
                text: r.n + this.dealWinOrLoseScore(r.s),
              },
            }),
              this.dataSource.push(o);
          }
          this.list_match_history.dataSource = this.dataSource;
        }
      }),
      (o.prototype.onLoadCurrentMonthHistoryData = function (t) {
        if (0 == t.code) {
          this.histArray = t.list;
          var o;
          this.dataSource = [];
          for (var e = 0; e < this.histArray.length; e++) {
            var r = this.histArray[e];
            (o = {
              label_matchA_Index: { text: this.dealWinOrLose(r.r) },
              label_matchA_his_name: {
                text: r.n + this.dealWinOrLoseScore(r.s),
              },
            }),
              this.dataSource.push(o);
          }
          this.list_match_history.dataSource = this.dataSource;
        }
      }),
      (o.prototype.dealWinOrLose = function (t) {
        return "0" == t ? "败" : "1" == t ? "胜" : t;
      }),
      (o.prototype.dealWinOrLoseScore = function (t) {
        return "0" == t ? "(+0)" : "1" == t ? "(+1)" : t;
      }),
      (o.prototype.onMatchHistoryCloseActin = function () {
        this.close();
      }),
      (o.close = function () {
        this.matchHistoryV &&
          (this.matchHistoryV.close(), (this.matchHistoryV = null));
      }),
      o
    );
  })(ui.ChallengeBattle.MatchHistoryDialogUI);
